package org.andy.shop.service;


import java.util.List;

import javax.annotation.Resource;

import org.andy.shop.dao.UserInfoMapper;
import org.andy.shop.model.UserInfo;
import org.springframework.stereotype.Service;


@Service
public class UserService {
	
	@Resource
	private UserInfoMapper userInfoMapper;

	public boolean validName(UserInfo userInfo) {
		List<UserInfo> list = userInfoMapper.list(userInfo,null,null);
		if(list.isEmpty()) {
			return true;
		}else {
			return false;
		}
	}

	public List<UserInfo> list(UserInfo userInfo, Integer rows, Integer pageNumber) {
		Integer start = null;
		if(rows != null) {
			start = rows*(pageNumber-1);
		}
		return userInfoMapper.list(userInfo,start,rows);
	}
}
